﻿using AutoMapper;
using BestTrader.Cms.Models;
using BestTrader.Cms.ViewModels;
using BestTrader.Cms.ViewModels.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BestTrader.Cms.WebApi.Profiles
{
    public class MapperProfiles : Profile
    {
        public MapperProfiles()
        {

            #region Account

            CreateMap<Manager, LoginOutput>();
            CreateMap<Manager, ManagerListModel>();

           

            CreateMap<ModifyUserInfoIntput, Manager> ();

            CreateMap<TerminalRegisterInput, ManagerTerminalRegisterModel>();

            CreateMap<ManagerTerminalRegisterModel, Manager>();
            CreateMap<ManagerLoginModel, TerminalRegisterOutput>();

            CreateMap<ItemsDetailModel,AgentNameOutput>();

            CreateMap<ManagerListModel,ManagerInfoOutput>();

            #endregion

            #region RebateRecord

            CreateMap<RebateRecordInput, RebateRecordRequestModel>();

            #endregion

            #region RebateExtract

            CreateMap<RebateExtract, RebateExtractListModel>();
            CreateMap<RebateExtractAddOrModifyModel, RebateExtract>();
            CreateMap<ApplyRebateExtractInput, RebateExtractAddOrModifyModel>();
            CreateMap<RebateExtractRecordInput, RebateExtractRequestModel>();
            #endregion

            #region
            CreateMap<Manager, InCoinUserModel>();
            CreateMap<Manager, OutCoinUserModel>();

            CreateMap<OutCashModel, UCInOutCash>();
            CreateMap<InCashModel, UCInOutCash>();
            CreateMap<AddInCoinInput, InCashModel>();
            
            CreateMap<UCInOutCash, ConfirmInCashModel>();
            CreateMap<InOutCoinRecordInput,InOutCoinRecordRequestModel>();

            CreateMap<QRCodeModel, UCAlipayInCash>()
                    .ForMember(dto => dto.QRCode, opt => opt.MapFrom(entity => entity.qrcode))
                    .ForMember(dto => dto.State, opt => opt.MapFrom(entity => entity.state))
                    .ForMember(dto => dto.Order, opt => opt.MapFrom(entity => entity.order))
                    .ForMember(dto => dto.Data, opt => opt.MapFrom(entity => entity.data))
                    .ForMember(dto => dto.Money, opt => opt.MapFrom(entity => entity.money))
                    .ForMember(dto => dto.Times, opt => opt.MapFrom(entity => entity.times))
                    .ForMember(dto => dto.OrderStatus, opt => opt.MapFrom(entity => entity.orderstatus))
                    .ForMember(dto => dto.Text, opt => opt.MapFrom(entity => entity.text));

            #endregion

            #region GomePay

            CreateMap<UCInOutCash, GomePayDFAddModel>()
                    .ForMember(dto => dto.ManagerId, opt => opt.MapFrom(entity => entity.UserManagerId))
                    .ForMember(dto => dto.UserName, opt => opt.MapFrom(entity => entity.UserName))
                    .ForMember(dto => dto.CustomerName, opt => opt.MapFrom(entity => entity.UserRealName))
                    .ForMember(dto => dto.Amount, opt => opt.MapFrom(entity => entity.RMBMoney))
                    .ForMember(dto => dto.IssueBankName, opt => opt.MapFrom(entity => entity.UserBankType))
                    .ForMember(dto => dto.AccountNumber, opt => opt.MapFrom(entity => entity.UserCardNo))
                    .ForMember(dto => dto.OrderNumber, opt => opt.MapFrom(entity => entity.OrderNo));


            CreateMap<GomePayDFAddModel, UCGomePayDF>();

            CreateMap<GomePayDFAddModel, GomePayDFModel>();

            #endregion

            #region HistoryCash

            CreateMap<History_CashChanges, HistoryCashModel>();

            #endregion

        }

    }
}
